import java.util.Collections;
import java.util.PriorityQueue;

public class Test {
    public static void main(String[] args) {
        PriorityQueue<Integer> minHeap = new PriorityQueue<>();
        PriorityQueue<Integer> maxHeap = new PriorityQueue<>(Collections.reverseOrder());
        minHeap.add(10);
        minHeap.add(8);
        minHeap.add(9);
        minHeap.add(11);
        minHeap.add(2);
        maxHeap.add(10);
        maxHeap.add(8);
        maxHeap.add(9);
        maxHeap.add(11);
        maxHeap.add(2);
        System.out.println(minHeap.toString());
        System.out.println(maxHeap.toString());
        // 堆顶元素
        minHeap.peek();
        // 删除
        minHeap.poll();
    }
}
